<?php

namespace Modules\Article\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Illuminate\View\FileViewFinder;
use View;
class HomeController extends Controller
{

    public function __construct()
    {
        //利用构造函数动态改变模板默认位置
        //获取admin模块中存储的定义默认模板的名称
        $default = \HDModule::config('admin.config.template');
        $template = [public_path('templates/' . $default)];
//        dd($template);
        View::setFinder(new FileViewFinder(app()->make('files'),$template));

    }

    /**
     * Display a listing of the resource.
     * @return Response
     */
    public function index()
    {
//        dd('article');
        return view('index');
    }

    /**
     * Show the form for creating a new resource.
     * @return Response
     */
    public function create()
    {
        return view('article::create');
    }

    /**
     * Store a newly created resource in storage.
     * @param  Request $request
     * @return Response
     */
    public function store(Request $request)
    {
    }

    /**
     * Show the specified resource.
     * @return Response
     */
    public function show()
    {
        return view('article::show');
    }

    /**
     * Show the form for editing the specified resource.
     * @return Response
     */
    public function edit()
    {
        return view('article::edit');
    }

    /**
     * Update the specified resource in storage.
     * @param  Request $request
     * @return Response
     */
    public function update(Request $request)
    {
    }

    /**
     * Remove the specified resource from storage.
     * @return Response
     */
    public function destroy()
    {
    }
}
